package com.base.common.exception;

import com.common.global.GlobalBaseEnum;
import org.springframework.http.HttpStatus;

/**
 * Error code
 *
 * @description: 规范错误码
 * @author: cyj
 * @date 2020 -10-15 16:59:31
 */
public enum ErrorCode implements GlobalBaseEnum {

    /**
     * Unknow error error code
     */
    UNKNOW_ERROR("1.2.0001", "未知异常", HttpStatus.INTERNAL_SERVER_ERROR);

    /**
     * Code
     */
    public String code;

    /**
     * Message
     */
    public String message;

    /**
     * Http status
     */
    public HttpStatus httpStatus;

    /**
     * Error code
     *
     * @param code       code
     * @param message    message
     * @param httpStatus http status
     */
    ErrorCode(String code, String message, HttpStatus httpStatus) {
        this.code = code;
        this.message = message;
        this.httpStatus = httpStatus;
    }


    @Override
    public String code() {
        return this.code;
    }

    @Override
    public String message() {
        return this.message;
    }
}
